<?php
declare(strict_types=1);
namespace Service\Code;

class Normal
{
    /* 通用  */
    const FAIL              = 0;   //错误信息
    const NO_LOGIN          = 100; //未登录
    const SUC               = 200; //获取数据成功
    const SETTLE_ERROR      = 300; //没有结算数据
    const AFTER_BALANCE_ERROR       = 100001; //操作失败[会员余额不足]
    const QUTAFROZEN_OVER_ERROR     = 100002; //操作失败[账期限额已用完],
    const AUTH_NO_LOGIN     = 401; //认证中心未登录,
    const AUTH_SUCCESS      = 200; //认证登录授权成功,
    const WS_START          = '1'; //进行中,
    const WS_END            = '2'; //已结束,
    const WS_ERROR          = '3'; //错误异常
    
    /**
     * 返回code
     * @param unknown $code
     * @param string $msg
     * @param array $data
     */
    public static function returnCode( $code = self::SUC , $msg = '',$data = [] ) {
        return [
            'code'  => $code,
            'msg'   => $msg,
            'data'  => $data,
        ];
    }

    /**
     * 返回成功code
     * @return array
     */
    public static function returnSuccessCode(): array
    {
        return self::returnCode(self::SUC,'处理成功');
    }
}